package com.warmheart.builder.user;

import com.warmheart.core.co.base.BaseCoBuilder;
import com.warmheart.core.co.oper.Co;
import com.warmheart.core.cors.enums.DateFormatEnum;
import com.warmheart.entity.user.UserBase;

/**
 * 
 * @ClassName: UserBase
 * @Description: 用户实体CoBuilder类，对应表名称为tb_user_base 温馨提示：不要修改该实体CoBuilder类的任何字段
 * @author ZhangJianyang
 * @date 2025年06月16日 下午13:05:35
 *
 */
public class UserBaseCoBuilder extends BaseCoBuilder<UserBase, UserBaseCoBuilder> {

    private final UserBase t;

    @Override
    protected UserBaseCoBuilder self() {
        return this;
    }

    @Override
    public UserBase core() {
        return this.t;
    }

    public UserBaseCoBuilder(UserBase userBase) {
        t = userBase;
    }

    /**
     * 真实姓名
     */
    private Co<UserBase, UserBaseCoBuilder> realName;

    /**
     * 邮箱
     */
    private Co<UserBase, UserBaseCoBuilder> email;

    /**
     * 手机号
     */
    private Co<UserBase, UserBaseCoBuilder> phone;

    /**
     * 部门
     */
    private Co<UserBase, UserBaseCoBuilder> department;

    /**
     * 职位
     */
    private Co<UserBase, UserBaseCoBuilder> position;

    /**
     * 是否激活
     */
    private Co<UserBase, UserBaseCoBuilder> state;

    /**
     * 最后登录时间
     */
    private Co<UserBase, UserBaseCoBuilder> lastLogin;

    public Co<UserBase, UserBaseCoBuilder> realName() {
        if (this.realName == null) {
            this.realName = new Co<UserBase, UserBaseCoBuilder>(self(), "real_name");
        }
        return this.realName;
    }

    public Co<UserBase, UserBaseCoBuilder> email() {
        if (this.email == null) {
            this.email = new Co<UserBase, UserBaseCoBuilder>(self(), "email");
        }
        return this.email;
    }

    public Co<UserBase, UserBaseCoBuilder> phone() {
        if (this.phone == null) {
            this.phone = new Co<UserBase, UserBaseCoBuilder>(self(), "phone");
        }
        return this.phone;
    }

    public Co<UserBase, UserBaseCoBuilder> department() {
        if (this.department == null) {
            this.department = new Co<UserBase, UserBaseCoBuilder>(self(), "department");
        }
        return this.department;
    }

    public Co<UserBase, UserBaseCoBuilder> position() {
        if (this.position == null) {
            this.position = new Co<UserBase, UserBaseCoBuilder>(self(), "position");
        }
        return this.position;
    }

    public Co<UserBase, UserBaseCoBuilder> state() {
        if (this.state == null) {
            this.state = new Co<UserBase, UserBaseCoBuilder>(self(), "state");
        }
        return this.state;
    }

    public Co<UserBase, UserBaseCoBuilder> lastLogin(DateFormatEnum... dateFormatEnums) {
        if (this.lastLogin == null) {
            if (dateFormatEnums != null && dateFormatEnums.length > 0) {
                this.lastLogin = new Co<UserBase, UserBaseCoBuilder>(self(), "last_login",
                        dateFormatEnums[0].getValue());
            } else {
                this.lastLogin = new Co<UserBase, UserBaseCoBuilder>(self(), "last_login",
                        DateFormatEnum.yyyy_MM_dd.getValue());
            }
        }
        return this.lastLogin;
    }
}